/**
 * @file wa_wm.h
 *
 */

#ifndef _WA_WM_H
#define _WA_WM_H

#ifdef __cplusplus
extern "C" {
#endif

/*********************
*      INCLUDES
*********************/
#include "wa_conf.h"
#include <string.h>
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include "wa_misc.h"
#include "wa_area.h"
#include "wa_obj.h"
#include "wa_pid.h"
/*********************
*      DEFINES
*********************/

/**********************
*      TYPEDEFS
**********************/
typedef struct
{
	wa_result enable;
	int last_x;
	int last_y;

	wa_obj* act_obj;
	wa_obj* last_obj;

	wa_result obj_draging;
	wa_result obj_long_pressing;

	int press_timestamp;
	int longpress_rep_timestamp;

	int vect_x;
	int vect_y;

	wa_result drag_range_out;
	int drag_sum_x;
	int drag_sum_y;

}wa_wm_pid;

typedef struct
{
	wa_area redraw_rect;
	wa_result redraw_rect_have;
	wa_obj* obj_drawing;

	wa_wm_pid	pid;

}wa_wm_context;
/**********************
* GLOBAL PROTOTYPES
**********************/
extern wa_wm_context wm_context;

void wa_wm_module_init(void);
void wa_wm_handle(void);
void wa_wm_update_redraw_rect(wa_area* area);
void wa_wm_send_sign(wa_obj* obj, wa_sign* sign);
void wa_wm_send_sign_nodata(wa_obj* obj, int sign_id);
void wa_wm_notify_parent(wa_obj* obj, int sign_id);
void wa_wm_pid_handle(void);

/**********************
*      MACROS
**********************/


#ifdef __cplusplus
} /* extern "C" */
#endif

#endif
